{% extends 'homepage.html' %}
{% block content %}

<script>
var cur_system = null;
function show_code(system) {
    $('.sage').hide();
    $('.pari').hide();
    $('.magma').hide();
    if (cur_system == null) {
      $('.'+system).show();
      cur_system = system;
    } else {
      $('.'+system).hide();
      cur_system = null;
    }
}
</script>


    <div align ="right">
      Show commands for:  <a onclick="show_code('sage'); return false" href='#'>sage</a>,
        <a onclick="show_code('pari'); return false" href='#'>pari</a>,
        <a onclick="show_code('magma'); return false" href='#'>magma</a>
    </div>
    <div></div>
    
    <h2> {{ KNOWL('ec.q.minimal_weierstrass_equation', title='Minimal Weierstrass equation') }} </h2>
    <div class='sage nodisplay code'>sage: E = EllipticCurve({{info.ainvs}})</div>
    <div class='pari nodisplay code'>? E = ellinit({{info.ainvs}})</div>
    <div class='magma nodisplay code'>&gt; E := EllipticCurve({{info.ainvs}});</div>
    <p> {{ info.equation }} </p>

    <h2> {{ KNOWL('ec.q.mordell-weil', title='Mordel-Weil group') }} structure</h2>
   <div>{% if info.rank==1 %}{% if info.torsion!=1 %} \(\mathbb{Z}\times {{info.tor_structure}}\) 
    {%endif%}  {%endif%}     </div>

    <div>{% if info.rank==1 %}{% if info.torsion==1 %}\(\mathbb{Z}\) {%endif%}  {%endif%} </div>
    <div> {% if info.rank !=0 and info.rank!=1 %} {% if info.torsion!=1 %}\(\mathbb{Z}^{{info.rank}} \times {{info.tor_structure}}\) {%endif%}  {%endif%} </div>
    <div> {% if info.rank !=0 and info.rank!=1%} {% if info.torsion==1 %} \(\mathbb{Z}^{{info.rank}}\){%endif%}  {%endif%} </div>
    <div> {% if info.rank ==0 %} {% if info.torsion!=1 %} \({{info.tor_structure}}\){%endif%}  {%endif%} </div>
    <div> {% if info.rank ==0 %} {% if info.torsion==1 %} Trivial {%endif%}  {%endif%} </div>
    
    {% if info.rank!=0 %}    
    <p><h3> Infinite order Mordell-Weil generators </h3>
    <div class='sage nodisplay code'>sage: E.gens()</div>
    <div class='pari nodisplay code'> </div>
    <div class='magma nodisplay code'>&gt; Generators(E);</div>
    <p> {{ info.generators }} </p></p>
    {%endif %}
    
    {% if info.torsion!=1 %}    
    <p><h2> {{ KNOWL('ec.q.torsion_generators', title='Torsion generators') }}</h2>
    <div class='sage nodisplay code'>sage: E.torsion_subgroup()</div>
    <div class='pari nodisplay code'>? elltors(E) </div>
    <div class='magma nodisplay code'>&gt; TorsionSubgroup(E);</div>
    <p> {{ info.tor_gens }} </p></p>
    {%endif %}


    <p><h2> {{ KNOWL('ec.q.integral_points', title='Integral points') }}</h2>
    <div> Note: If $P$ is integral, then so is $-P$, and only one of those points is listed. </div>
    <div class='sage nodisplay code'>sage: E.integral_points()</div>
    <div class='pari nodisplay code'> </div>
    <div class='magma nodisplay code'>&gt; ;</div>
    <p> {{ info.xintegral_points}} </p>
    
    <h2> {{ KNOWL('ec.q.invariants', title='Invariants') }}  </h2>
        <table>

        <tr>
        <td colspan="4">
            <span class='sage nodisplay code'>sage: E.conductor().factor()</span>
            <span class='pari nodisplay code'></span>
            <span class='magma nodisplay code'></span>
        </td>
        </tr>
        <tr>
        <td colspan="4">
         \(N \)</td>
        <td>=</td>
        <td>\({{ info.cond_factor }}\)</td>
        </tr>

        <tr>
        <td colspan="4">
            <span class='sage nodisplay code'>sage: E.discriminant().factor()</span>
            <span class='pari nodisplay code'>? E[12]</span>
            <span class='magma nodisplay code'>&gt; Discriminant(E);</span>
        </td>
        </tr>
        <tr>
        <td colspan="4"> \(\Delta \)</td>
        <td>=</td>
        <td>\({{ info.disc_factor }} \)</td>
        </tr>

        <tr>
        <td colspan="4">
            <span class='sage nodisplay code'>sage: E.j_invariant().factor()</span>
            <span class='pari nodisplay code'>? E[13]</span>
            <span class='magma nodisplay code'>&gt; jInvariant(E);</span>
        </td>
        </tr>
        <tr>
        <td colspan="4"> \(j \)</td>
        <td>=</td>
        <td>\({{ info.j_invar_factor }}\)</td>
        </tr>


       </table>

    <h2> {{ KNOWL('ec.q.bsd_invariants', title='BSD invariants') }} </h2>
    <div></div>
    <p>
        <table>

        <tr>
        <td colspan="4">
            <span class='sage nodisplay code'>sage: E.rank()</span>
            <span class='pari nodisplay code'></span>
            <span class='magma nodisplay code'>&gt; Rank(E);</span>
        </td>
        </tr>
        <tr>
        <td colspan="4">
            \( r \) </td><td>=</td><td> {{ info.rank }}
        </td>
        </tr>


        <tr>
        <td colspan="4">
            <span class='sage nodisplay code'>sage: E.regulator()</span>
            <span class='pari nodisplay code'></span>
            <span class='magma nodisplay code'>&gt; Regulator(E);</span>
        </td>
        </tr>
        <tr>
        <td colspan="4"> 
           \( \text{Reg} \) </td><td>=</td><td> {{ info.regulator }}</td>
        </tr>

        <tr>
        <td colspan="4">
            <span class='sage nodisplay code'>sage: E.period_lattice().omega()</span>
            <span class='pari nodisplay code'></span>
            <span class='magma nodisplay code'>&gt; RealPeriod(E);</span>
        </td>
        </tr>
        <tr>
        <td colspan="4">
           \( \Omega \) </td><td>=</td><td> {{ info.real_period }}</td>
        </tr>

        <tr>
        <td colspan="4">
            <span class='sage nodisplay code'>sage: E.tamagawa_numbers()</span>
            <span class='pari nodisplay code'></span>
            <span class='magma nodisplay code'>&gt; TamagawaNumbers(E);</span>
        </td>
        </tr>
        <tr>
        <td colspan="4">
         \( \prod_p c_p \)</td><td>=</td><td>\( {{ info.tamagawa_numbers }} \)</td>
        </tr>

        <tr>
        <td colspan="4">
            <span class='sage nodisplay code'>sage: E.torsion_order()</span>
            <span class='pari nodisplay code'>? elltors(E)[1]</span>
            <span class='magma nodisplay code'>&gt; OrderTorsionSubgroup(E);</span>
        </td>
        </tr>
        <tr>
        <td colspan="4"> \( \#E_{tor} \)</td>
        <td>=</td><td>{{ info.torsion }}</td>
        </tr>

        <tr>
        <td colspan="4">
            <span class='sage nodisplay code'>sage: E.sha().an_numerical()</span>
            <span class='pari nodisplay code'></span>
            <span class='magma nodisplay code'>&gt; MordellWeilShaInformation(E);</span>
        </td>
        </tr>
        <tr>
        <td colspan="4"> &#1064;\(_{an} \) </td>
        <td>=</td>
        <td>{{ info.sha_an }}</td>
        </tr>

        </table>
    </p>

<!-- %%%%%%%%%%%%%%%% END OF TABLE %%%%%%%%%%%%%%%%%%% -->

    <h2> {{KNOWL('ec.q.modular_form', title='Modular form')}} </h2>
    <div class='sage nodisplay code'>sage: E.q_eigenform(10)</div>
    <div class='pari nodisplay code'></div>
    <div class='magma nodisplay code'>&gt; ModularForm(E);</div>
    <p>
    <form>
        <div class="output"><span id="modform_output">{{ info.f | safe }}</span></div>
        <div class="emptyspace"><br></div>
        <button id="morebutton">More</button>
    </form>
    </p>
    <p align="left">
        <a  href='{{info.download_qexp_url}}' target='_blank' >download coefficients</a>
    </p>

    <h2> {{KNOWL('ec.q.special_value', title='Special $L$-values', special_value = info.special_value)}} attached to the curve </h2>
        \( {{ info.lder }} = {{ info.special_value}} \)
    </p>
    
    <h2> \( p \)-adic data </h2>
    <p>
        <select onchange="$('#padic').load('{{url_for('padic_data', label=info.label, p='xxx', rank=info.rank).replace('xxx', "'+this.value+'")}}', function() { MathJax.Hub.Queue(['Typeset',MathJax.Hub,'padic']);}); ">
        <option value=''>Choose a prime...</option>
        {% for p in info.p_adic_primes %}
        <option value="{{ p }}">{{ p }}</option>
        {% endfor %}
        </select>
        <div id='padic'>
        </div>
    </p>

    <h2> Plot of real points</h2>
    <div class='sage nodisplay code'>sage: E.plot()</div>
    <div class='pari nodisplay code'> </div>
    <div class='magma nodisplay code'> </div>
    <center>
    <img src="{{info.plot}}" />
    </center>

<script type="text/javascript">
var number_of_coefficients = 10;
function more_handler(evt) {
    number_of_coefficients += number_of_coefficients;
    evt.preventDefault();
    $("#modform_output").load("/EllipticCurve/Q/modular_form_display/{{info.label}}/"+number_of_coefficients,
        function() {
            {# tell mathjx to render the output #}
            MathJax.Hub.Queue(['Typeset', MathJax.Hub, "modform_output"]);
        });
}
$(function() {
    $("#morebutton").click(function(e) {more_handler(e)});
});
</script>
    
        
{% endblock %}
